<template>
	<view class="">
		<scroll-view @scrolltolower="loadMoreData" scroll-y="true" enable-back-to-top="true" lower-threshold="112" class="scrollbox">
			<view @click="contentBtnok" class="content_scroll" v-for="(item, index) in infoData" :key="index">
				<view class="content_top">
					<view style="margin-bottom: 20rpx">
						<image style="width: 50rpx; height: 50rpx" src="../../../static/mappages/outbound/rk.png" mode=""></image>
						<text style="margin-left: 20rpx">{{ item.no }}</text>
					</view>
				</view>
				<view class="content_center">
					<view class="content_centerFlex">
						<view class="formgroup">操作人 :</view>
						<view class="groupholder">{{ item.checkBy_dictText }}</view>
					</view>
					<view class="content_centerFlex">
						<view class="formgroup">库存是否调整 :</view>
						<view :style="{ color: item.adjustStatus == 2 ? '#53b937' : item.adjustStatus == 1 ? '#e52623' : '#4887c2' }" class="groupholder">
							{{ item.adjustStatus_dictText }}
						</view>
					</view>
					<view class="content_centerFlex">
						<view class="formgroup">盘点时间 :</view>
						<view class="groupholder">{{ item.createTime }}</view>
					</view>
				</view>
			</view>
			<u-loading-icon style="margin-top: 50rpx" v-if="noticeInfo.isBoolean"></u-loading-icon>
			<uni-load-more v-if="!noticeInfo.isBoolean" status="暂无更多" />
		</scroll-view>

		<uni-fab horizontal="right" vertical="bottom" ref="fab" @fabClick="fabClick" />
	</view>
</template>

<script>
import { getGoods } from '@/api/mappages/Inventory/Inventory.js';
export default {
	data() {
		return {
			infoData: [],
			noticeInfo: {
				page: 1,
				size: 5,
				isBoolean: true
			}
		};
	},
	mounted() {
		this.isNoticeFow();
	},
	methods: {
		async isNoticeFow() {
			let brr = {
				page: this.noticeInfo.page,
				size: this.noticeInfo.size,
				nub: 1
			};
			getGoods(brr).then((res) => {
				if (!res.result) return (this.noticeInfo.isBoolean = false);
				if (this.noticeInfo.page > 1 && res.result.total >= this.noticeInfo.size) {
					const previousData = [...this.infoData];
					this.infoData = [...previousData, ...res.result.records];
				} else {
					this.noticeInfo.isBoolean = true;
					this.infoData = res.result.records;
				}

				if (res.result.total === this.infoData.length) {
					this.noticeInfo.isBoolean = false;
				}
			});
		},
		// 触底刷新事件
		loadMoreData() {
			this.noticeInfo.page += 1;
			!this.noticeInfo.isBoolean ? '' : this.isNoticeFow();
		},
		//河道巡查 点击事件
		contentBtnok(item) {
			console.log(item, '河道巡222查');
		},
		fabClick() {
			this.$tab.navigateTo('/mappages/Inventory/retrieval/retrieval');
		}
	},
	onReachBottom() {
		this.noticeInfo.page += 1;
		!this.noticeInfo.isBoolean ? '' : this.isNoticeFow();
		console.log(111);
	}
};
</script>

<style scoped lang="scss">
.scrollbox {
	height: calc(100vh - 180rpx);
}
.content_scroll {
	margin-top: 5rpx;
	width: 100%;
	background-color: #fff;
	padding: 22rpx;
}

.content_top {
	display: flex;
	justify-content: space-between;
}

.content_top view {
	display: flex;
	align-items: center;
}

.content_center {
	display: flex;
	flex-direction: column;
	color: #000;
}
.content_centerFlex {
	display: flex;
	flex-direction: row;
	align-items: center;
	color: #666666;
	height: 50rpx;
}
.formgroup {
}
.groupholder {
	margin-left: 22rpx;
}
.content_button {
	margin: 20rpx 0;
}
</style>
